package com.txunda.zhuohired.aty.user.my;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.ants.theantsgo.util.JSONUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;
import com.txunda.zhuohired.R;
import com.txunda.zhuohired.base.BaseAty;
import com.txunda.zhuohired.http.pst.InfoPst;

import java.util.Map;

/**
 * 创建人： Txd_Cjh
 * 创建时间： 2018/3/9 16:30
 * 功能描述：修改登录密码
 * 联系方式：jiahuanchen@126.com
 */

public class ModifyPassAty extends BaseAty {

    /**
     * 标题
     */
    @ViewInject(R.id.tv_layout_white_center)
    private TextView tv_layout_white_center;
    @ViewInject(R.id.et_modify_pass_phone)
    private EditText et_modify_pass_phone;

    private InfoPst infoPst;
    private String token;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        showStatusBar(R.id.layout_white_head);
        tv_layout_white_center.setText("修改登录密码");
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.aty_modify_pass;
    }

    @Override
    protected void initialized() {
        infoPst = new InfoPst(this);
        token = application.getUserInfo().get("data");
    }

    @OnClick({R.id.tv_modify_pass_send,R.id.tv_modify_pass_submit})
    @Override
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()) {
            case R.id.tv_modify_pass_send:

                break;
            case R.id.tv_modify_pass_submit:

                break;
            default:
                break;
        }
    }

    @Override
    protected void requestData() {
        infoPst.inPassword(token);
    }

    @Override
    public void onComplete(String requestUrl, String jsonStr) {
        super.onComplete(requestUrl, jsonStr);

        Map<String,String> map = JSONUtils.parseKeyAndValueToMap(jsonStr);

        Map<String ,String> data = JSONUtils.parseKeyAndValueToMap(map.get("data"));

        if(map.get("code").equals("1")){
            et_modify_pass_phone.setText(data.get("phone"));
        }else{
            return;
        }

    }
}
